package com.hugoo.rpt.busz;

import com.hugoo.core.Conf;
import com.hugoo.core.ConfigurationError;
import com.hugoo.core.db.ResultPack;
import com.hugoo.core.db.rp.XlsResultPack;
import com.hugoo.rpt.ExpPageInfo;
import com.hugoo.rpt.ParamError;
import com.hugoo.rpt.RptPageInfo;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Hugoo.Chan
 */
public class XlsExpAction extends RptPageInfo implements ExpPageInfo {

    public XlsExpAction(String sid, HttpServletRequest request) throws ParamError, ConfigurationError {
        super(sid, request);
    }

    @Override
    public String getFileName() {
        return getTitle() + ".xls";
    }

    private String fmt_init(String st) {
        if (st == null) {
            st = "";
        } else {
            st = "," + st + ",";
        }
        return st;
    }

    public String getFNUMColumns() {
        String st = Conf.getAutqProp2(_sid, Conf.RPT._rpt_xls_fnum_cols);//读取整数
        return this.fmt_init(st);
    }


    @Override
    public ResultPack getResultPack() {
        return new XlsResultPack(this, col);
    }

    @Override
    protected String getDeclareColumnInfo() {
        return Conf.getAutqProp2(_sid, Conf.RPT._rpt_xls_columns);
    }
}
